﻿<Page
    x:Name="pageRoot"
    x:Class="Instemote.MainPage"
    DataContext="{Binding DefaultViewModel, RelativeSource={RelativeSource Self}}"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Instemote"
    xmlns:common="using:Instemote.Common"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Page.Resources>
        <!-- TODO: Delete this line if the key AppName is declared in App.xaml -->
        <x:String x:Key="AppName">My Application</x:String>
    </Page.Resources>

    <!--
        This grid acts as a root panel for the page that defines two rows:
        * Row 0 contains the back button and page title
        * Row 1 contains the rest of the page layout
    -->
    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <Grid.ChildrenTransitions>
            <TransitionCollection>
                <EntranceThemeTransition/>
            </TransitionCollection>
        </Grid.ChildrenTransitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="140"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!-- Back button and page title -->
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="40"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>

            <TextBlock x:Name="pageTitle" Text="Scenes" Style="{StaticResource HeaderTextBlockStyle}" Grid.Column="1" 
                        IsHitTestVisible="false" TextWrapping="NoWrap" VerticalAlignment="Bottom" Margin="0,0,30,40"/>
        </Grid>
        
        <Grid Grid.Row="1">    
            <GridView
            x:Name="SceneList"
            AutomationProperties.AutomationId="ItemsGridView"
            AutomationProperties.Name="Items"
            TabIndex="1"
            SelectionMode="None"
            IsSwipeEnabled="false">
                <GridView.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Margin="0,0,0,12">
                            <StackPanel.Transitions>
                                <TransitionCollection>
                                    <ContentThemeTransition />
                                </TransitionCollection>
                            </StackPanel.Transitions>

                            <TextBlock Text="{Binding Name}" FontSize="30" Foreground="#0B6CF8"/>
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Button Content="off" Grid.Column="1" Tapped="OffButton_Tapped" HorizontalAlignment="Stretch" Margin="12,0,0,0"></Button>
                                <Button Content="on" Grid.Column="0"  Tapped="OnButton_Tapped" HorizontalAlignment="Stretch" Margin="0,0,12,0"></Button>
                            </Grid>
                        </StackPanel>
                    </DataTemplate>
                </GridView.ItemTemplate>
            </GridView>
        </Grid>    
        
        <ProgressBar x:Name="StatusBar" VerticalAlignment="Top" Visibility="Collapsed"/>
    </Grid>
</Page>
